package kr.hkit.powerjava.chapter06.assign_if;

public class Three {

	private int type, age, time, price;

	public void setType(int type) {
		this.type = type;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public void setTime(int time) {
		this.time = time;
	}

	int calPrice(){
		
		switch(type){
		case 0://자유이용권
			if((age >= 3 && age <=12) || (age>=65)){
				if(time>=17 && time<24){
					price = 21000;
				}
				else{
					price = 25000;
				}
			}
			else if(age <3)
				price = 0;
			else{
				if(time>=17 && time<24){
					price = 29000;
				}
				else{
					price = 34000;
				}
			}
			break;
			
		case 1://입장권
			if((age >= 3 && age <=12) || (age>=65)){
				if(time>=17 && time<24){
					price = 17000;
				}
				else{
					price = 20000;
				}
			}
			else if(age <3)
				price = 0;
			else{
				if(time>=17 && time<24){
					price = 23000;
				}
				else{
					price = 27000;
				}
			}
			break;
			
		default:
			break;
		}
		return price;
	}

	@Override
	public String toString() {
		
		return "Three [지불하여야 하는 요금은 " + calPrice() + "원 입니다]";
	}
	
	
}
